#!/usr/bin/perl -w
use strict;

open my $file1, $ARGV[0] or die "Can't open file1: $!";
open my $file2, $ARGV[1] or die "Can't open file1: $!";

my @data1=<$file1>;
my @data2=<$file2>;
close $file1;
close $file2;

my (@pos1, @pos2, @line, @pos_intersect);


foreach (@data1) {
	@line = split /\t/;
	push @pos1, $line[0] . '-' . $line[1];
	
}

foreach (@data2) {
	@line = split /\t/;
	push @pos2, $line[0] . '-' . $line[1];
}



foreach (@pos1) {
	my $pos=$_;
	my $i=0;
	foreach (@pos2) {
		if (/^$pos$/) {
			push @pos_intersect, $i;
		}
		$i++;
	}
}
# print @pos_intersect;
# grep {} @pos2

foreach (@pos_intersect) {
	print $data2[$_];
}

